<link rel="stylesheet" href="/css/tb.css">
<h4>推流客户端</h4>
<form>
    <table class="form-group" id="tb-main"><tbody>
        <tr>
            <th>ID</th>
            <th>Key</th>
            <th>连接状态</th>
            <th>推流状态</th>
            <th>操作</th>
        </tr>
        <% if(pushers!=undefined) {console.log(pushers);for(const pu in pushers) {%>
            <tr>
                <td><span><%= pu %></span></td>
                <td><span><%= pushers[pu].key %></span></td>
                <td><span><%= pushers[pu].ws === null?"未连接":"已连接" %></span></td>
                <td><span id="status-<%=pu%>">正在查询……</span></td>
                <td>
                    <% if(pushers[pu].ws != null) { %>
                    <a href="javascript:start_push('<%=pu%>')" id="start-<%=pu%>" class="btn btn-success btn-sm">推流</i></a>
                    <a href="javascript:stop_push('<%=pu%>')" id="stop-<%=pu%>" class="btn btn-secondary btn-sm">终止</i></a>
                    <% } %>
                    <a href="javascript:del_pusher('<%=pu%>')" class="btn btn-danger btn-sm">删除</i></a>
                </td>
            </tr>
        <% }} %>
        <tr>
            <td><input class="form-control-sm" id="new-id" type="text" class="form-control"/></td>
            <td><input class="form-control-sm" id="new-key" type="text" class="form-control"/></td>
            <td></td><td></td>
            <td>
                <a href="javascript:add_pusher()" class="btn btn-primary btn-sm">添加</i></a>
            </td>
        </tr>
    </tbody></table>
</form>
<p id="te_tip" class="text-danger" style="display:none"></p>
<script src="/js/channels.js"></script>
<script src="/js/pushers.js"></script>